"use strict";
cc._RF.push(module, 'b152cKFuzdCc4BhxfXx/Vd0', 'CaseManager');
// scripts/common/CaseManager.ts

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CaseInfoMap = void 0;
var EventManager_1 = require("../../eazax-ccc/core/EventManager");
var SceneNavigator_1 = require("../../eazax-ccc/core/SceneNavigator");
var BrowserUtil_1 = require("../../eazax-ccc/utils/BrowserUtil");
var Toast_1 = require("./components/Toast");
var Constants_1 = require("./constants/Constants");
var CustomEvents_1 = require("./constants/CustomEvents");
/**
 * 示例管理器
 */
var CaseManager = /** @class */ (function () {
    function CaseManager() {
    }
    /**
     * 前往首页
     */
    CaseManager.goHome = function () {
        eazax.log('[Go Home]', '^.^');
        // 清除当前 URL 的参数
        BrowserUtil_1.default.clearUrlParam();
        // 跳转
        SceneNavigator_1.default.goHome(null);
        EventManager_1.default.emit(CustomEvents_1.CHANGE_SCENE, Constants_1.SceneName.Home);
    };
    /**
     * 前往对应示例
     * @param caseName 示例名称
     */
    CaseManager.goCase = function (caseName) {
        eazax.log('[Go Case]', caseName);
        // 示例信息
        var info = this.getCaseInfo(caseName);
        if (!info) {
            Toast_1.default.show('啊哦，没有找到这个示例', caseName);
            return false;
        }
        var sceneName = info.scene;
        SceneNavigator_1.default.go(sceneName, null, function () {
            // 设置当前 URL 的参数
            BrowserUtil_1.default.setUrlParam("case=" + caseName);
            // 事件
            EventManager_1.default.emit(CustomEvents_1.SWITCH_CASE, sceneName);
        });
        return true;
    };
    /**
     * 是否有对应示例
     * @param caseName 示例名称
     */
    CaseManager.hasCase = function (caseName) {
        return !!this.getCaseInfo(caseName);
    };
    /**
     * 获取示例信息
     * @param caseName 示例名称
     */
    CaseManager.getCaseInfo = function (caseName) {
        return exports.CaseInfoMap[caseName];
    };
    return CaseManager;
}());
exports.default = CaseManager;
/** 示例名称到示例信息的映射表 */
exports.CaseInfoMap = {
    Track: {
        name: '子弹追踪',
        scene: 'Track'
    },
};

cc._RF.pop();